<script src="{base_href}client/jscript/CheckBoxGroup.js" type="text/javascript"></script>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
    function setDisabledByCheckbox(pref) {

        var ch = document.getElementById("is_"+pref);

        for(var i=0; i<dates.length; i++) {
            var r = (ch.checked) ? false : true;
            SetDisabled(pref, r);
        }
    }
    function setDisabled(pref, value) {
        var dates = new Array("day", "month", "year");
        for(var i=0; i<dates.length; i++) {
            var f = document.getElementById(pref+"_"+dates[i]);
            f.disabled = value;
        }
    }
    function setDisabledByPeriod(value) {
        if(value == 'custom') {
            setDisabled('from', false);
            setDisabled('to', false);
        } else {
            setDisabled('from', true);
            setDisabled('to', true);
        }
    }
    function hideShowCustomPeriod(value) {
        t = document.getElementById('table_custom_period');
        p = document.getElementById('period_val');
        if(value != 'all') {
            p.style.display = 'block';
        } else{
            p.style.display = 'none';
        }
        if(value == 'custom') {
            t.style.display = 'inline';
            setDisabled('from', false);
            setDisabled('to', false);
        } else {
            t.style.display = 'none';
            setDisabled('from', true);
            setDisabled('to', true);
        }
    }

    function init() {
        //setDisabledByCheckbox('from');
        //setDisabledByCheckbox('to');
        //setDisabledByPeriod(document.getElementById('period').value);
        hideShowCustomPeriod(document.getElementById('period').value);
    }
    var myOptions = new CheckBoxGroup();
    myOptions.addToGroup('pv');
    myOptions.setRadioButtonBehavior();
    window.onload = init;
    //-->
</SCRIPT>
{user_msg}
<form action="{action_link}" name="" id="">
    <input type="hidden" name="s" id="s" value="1">
    {hidden}
    <table border="0" width="100%" cellpadding="5" cellspacing="0">
        <tr class="tdTitle">
            <td class="tdTitle" colspan="2">
                <!-- <b><a href="javascript:void(0)" onclick="">{advanced_search_msg}</a></b> -->
                <b>{advanced_search_msg}</b>
            </td>
        </tr>
    </table>
    <table border="0" width="100%" cellpadding="5" cellspacing="1">
        <tr class="tdSubTitle">
            <td width="50%"><b >{search_string_msg}</b></td>
            <td><b >{category_msg}</b></td>
        </tr>
        <tr class="trlighter" valign="top">
            <td>
                <input name="q" type="text" id="q"value="{q}" class="colorInput" style="width: 350px;" /><br />
                <br /><!-- <div style="padding-top: 7px; font-size: smaller;">
        <input type="checkbox" name="qt" id="qt" value="1" {qt_checked} /> {search_title_only_msg}
        </div><br /> -->
            </td>
            <td rowspan="5" valign="top">
                <select name="c[]" id="c" size="10" multiple class="colorInput" style="width: 350px;">
                    {category_select}
                </select>
                <div style="padding-top: 7px;">
                    <input type="checkbox" name="cp" id="cp" value="1" {cp_checked} /> {search_all_parent_msg}
                       </div>

            </td>
        </tr>
        <tr class="tdSubTitle">
            <td><b >{search_in_msg}</b></td>
            <!-- <td><b >{dates_range_msg}</b></td> -->
        </tr>
        <tr class="trlighter" valign="top">
            <td>
                <select name="in" id="in"class="colorInput" style="width: 350px;">
                    {search_in_select}
                </select><br /><br />
            </td>
            <!-- <td></td> -->
        </tr>
        <tr class="tdSubTitle">
            <td><b >{dates_range_msg}</b></td>
            <!-- <td><b >{dates_range_msg}</b></td> -->
        </tr>
        <tr class="trlighter" valign="top">
            <td>
                <table>
                    <tr valign="top">
                        <!-- <td width="60">{period_range_msg}:</td> -->
                        <td>
                            <select name="period" id="period" class="colorInput" style="width: 350px;"
                                    onclick="hideShowCustomPeriod(this.value)">
                                {period_select}
                            </select>
                            <div style="padding-top: 7px;" id="period_val" style="display: none;">
                                <input type="checkbox" name="pv" id="pv" value="p" onclick="myOptions.check(this)" {pvp_checked} /> {period_posted_msg}&nbsp;&nbsp;&nbsp;&nbsp;
                                       <input type="checkbox" name="pv" id="pv" value="u" onclick="myOptions.check(this)" {pvu_checked} /> {period_updated_msg}
                                   </div>
                        </td>
                    </tr>
                </table>
                <table id="table_custom_period" style="display: none;">
                    <tr><td colspan="2"><hr size="1" noshade="noshade" /></td></tr>
                    <tr>
                        <td>{date_from_msg}:&nbsp;</td>
                        <td>{date_from_select}&nbsp;&nbsp;
                            <input type="checkbox" name="is_from" id="is_from" value="1" checked
                                   onclick="setDisabled('from', (this.checked == false))" />
                        </td>
                    </tr>
                    <tr>
                        <td>{date_to_msg}:&nbsp;</td>
                        <td>{date_till_select}&nbsp;&nbsp;
                            <input type="checkbox" name="is_to" id="is_to" value="1" checked
                                   onclick="setDisabled('to', (this.checked == false))" />
                        </td>
                    </tr>
                </table>
            </td>
            <!-- <td></td> -->
        </tr>
    </table>
    <br />
    <div align="center">
        <input type="submit" name="sb" id="sb" value="{search_msg}" class="button" />
        <input type="button" value="{cancel_msg}" onclick="location.href='{cancel_link}'" class="button" />
    </div>
</form>
